Skip to content

[REFACTOR](schema) Extract overture-schema-validation package - #620

Open
Seth Fitzsimmons (sethfitz) wants to merge 1 commit into
mainfrom
extract-validation-package
Open

[REFACTOR](schema) Extract overture-schema-validation package#620
Seth Fitzsimmons (sethfitz) wants to merge 1 commit into
mainfrom
extract-validation-package

Conversation

@sethfitz

@sethfitz Seth Fitzsimmons (sethfitz) commented Jul 31, 2026

Copy link
Copy Markdown
Collaborator

validate() and validate_json() lived in the umbrella distribution's namespace __init__ (overture-schema/src/overture/schema/__init__.py), so the shared overture.schema namespace root carried real code owned by one distribution. This moves them into a new overture-schema-validation package (overture.schema.validation); the umbrella now depends on it, and its namespace __init__ becomes a bare pkgutil shim.

The immediate driver is packaging: freeing the namespace root of owned code is a precondition for the uv_build migration (PR 3), where a distribution cannot own code at a shared namespace root.

Open design question

Whether a standalone -validation package is the right long-term home, or just the minimal way to vacate the root, is worth deciding here rather than assuming. The larger direction this enables — and the reason a dedicated package earns its place beyond "move code off the root":

  • Pull validation-specific code out of -common and -system into -validation, so those packages carry model/type definitions and this one carries the validation API.
  • Expose PySpark validation through a [pyspark] extra on this package rather than the separate -pyspark runtime distribution.

This PR does none of that consolidation — it takes only the packaging-forced step (vacate the root). The broader move is deliberately out of scope pending agreement on the target shape. Flagging it so the review decides the destination before more code accretes around the current split.

Targets main directly — the #619 layer this originally stacked on was closed when the annex package was removed (c492317), so nothing precedes it now. Closes #622

@github-actions

github-actions Bot commented Jul 31, 2026

Copy link
Copy Markdown

🗺️ Schema reference docs preview is live!

🌍 Preview https://staging.overturemaps.org/schema/pr/620/schema/index.html
🕐 Updated Aug 04, 2026 23:49 UTC
📝 Commit 4ac6cc3
🔧 env SCHEMA_PREVIEW true

Note

♻️ This preview updates automatically with each push to this PR.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the overture.schema validation API by moving validate() / validate_json() out of the umbrella distribution’s shared namespace root into a new overture-schema-validation distribution (overture.schema.validation), leaving the namespace root as a pkgutil shim to support the planned packaging backend migration.

Changes:

  • Added new overture-schema-validation package providing overture.schema.validation.validate() and validate_json().
  • Removed implementation code from packages/overture-schema/src/overture/schema/__init__.py, leaving only the namespace shim.
  • Updated overture-schema to depend on the new package and updated tests/imports accordingly.

Reviewed changes

Copilot reviewed 7 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
uv.lock Adds overture-schema-validation to workspace members and dependency graph.
packages/overture-schema/tests/test_schema_validation.py Updates tests to import validation API from overture.schema.validation.
packages/overture-schema/src/overture/schema/init.py Removes validation implementation, leaving only pkgutil namespace shim.
packages/overture-schema/pyproject.toml Adds overture-schema-validation as a dependency and workspace source.
packages/overture-schema-validation/src/overture/schema/validation/py.typed Marks the new validation package as typed (PEP 561).
packages/overture-schema-validation/src/overture/schema/validation/init.py New home for the validation implementation.
packages/overture-schema-validation/src/overture/schema/init.py pkgutil namespace shim for overture.schema.
packages/overture-schema-validation/src/overture/init.py pkgutil namespace shim for overture.
packages/overture-schema-validation/pyproject.toml Defines the new distribution and its dependencies.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/overture-schema-validation/src/overture/schema/validation/__init__.py Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no longer stacked on #619" ?? Can you verify and update the description?

shouldn't test_schema_validation.py move to the new package too?

@sethfitz

Seth Fitzsimmons (sethfitz) commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator Author

Both addressed in 8d5a37a.

Description fixed — #619 was closed when the annex package was removed (c492317), so this stacks on nothing and targets main directly. Updated the body to say so.

Moved test_schema_validation.py into overture-schema-validation/tests/, and brought everything coupled to it along: its pyyaml/yamlcore dev-deps now sit on the new package, and the root pythonpath points at the new tests dir.

Two things surfaced while doing that move, both folded into the same commit:

  • deepdiff was declared in the umbrella's dev group but is only used by -common's tests — it resolved only because the workspace shares one venv. Moved it to -common.
  • With the test and its deps gone, the umbrella is a bare namespace shim, so its leftover dev group and its now-vestigial runtime pyyaml and pydantic and direct overture-schema-common deps are removed (both still arrive transitively).

The CLI still carries its own copy of the union-adapter validation logic instead of importing overture.schema.validation — left alone, since that's the consolidation this PR explicitly defers.

validate() and validate_json() lived in the overture-schema umbrella's
namespace __init__ (src/overture/schema/__init__.py), so the shared
overture.schema namespace root carried real code owned by one
distribution.  Move them into their own overture.schema.validation
module in a new overture-schema-validation package; the umbrella now
depends on it and its namespace __init__ is a bare pkgutil shim.

This separates the aggregator role from the validation API and prepares
the namespace root to become code-free -- a precondition for the
uv_build migration, where a distribution cannot own code at a shared
namespace root.

The test and dependencies coupled to that code move with it:

- test_schema_validation.py moves into
  overture-schema-validation/tests/, with the root pythonpath repointed
  and its pyyaml/yamlcore dev-deps now declared on the new package.
- deepdiff moves to overture-schema-common, where its tests actually use
  it; it was declared in the umbrella's dev group but unused there.
- The umbrella is now a bare namespace shim, so its dev group, its
  vestigial runtime pyyaml and pydantic deps, and its direct
  overture-schema-common dep are removed -- all still arrive
  transitively.
- overture-schema-validation gets a README.

Signed-off-by: Seth Fitzsimmons <seth@mojodna.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[REFACTOR] Extract the validation API out of the overture.schema namespace root

3 participants